package com.gxc.event;

import com.gxc.entity.User;
import java.time.LocalDate;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.ApplicationListener;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;

/**
 * 原始方式实现, 用户注册监听.
 *
 * @author 宫新程
 * @since 2018/12/6 11:20 AM
 */
@Component
@Slf4j
public class OldRegisterListener implements ApplicationListener<UserRegisterEvent> {

  @Override
  @Async
  public void onApplicationEvent(UserRegisterEvent userRegisterEvent) {
    User user = userRegisterEvent.getUser();
    log.info(
        "传统方式： _____ 用户名：{}，密码：{}，时间：{}",
        user.getUsername(),
        user.getPassword(),
        LocalDate.now());
  }
}
